

var search1 = document.querySelector(".search1");
var search2 = document.querySelector(".search2");

search1.addEventListener("mouseover", function () {
    search1.style.display = "none";
    search2.style.display = "block";
});
search2.addEventListener("mouseout", function () {
    search1.style.display = "block";
    search2.style.display = "none";
});
//搜索框经过的动画


var login = document.querySelector('.loginbh');
var hidden = document.querySelector('.login-hidden');

login.addEventListener("mouseover", function () {
    hidden.style.display = "block";
});

hidden.addEventListener("mouseover", function () {
    hidden.style.display = "block";
});

hidden.addEventListener("mouseout", function () {
    hidden.style.display = "none";
});
// 点击登录图标会显示的动画

var ljdenglu = document.querySelector('.hidden-down');
var dlbox = document.querySelector('.denglu');
var cuo = document.querySelector('.cuo');

ljdenglu.addEventListener("click", function () {
    dlbox.style.display = "block";

});
cuo.addEventListener("click", function () {
    dlbox.style.display = "none";
});
//登录页面

var dsj = document.querySelector('.dsj');
var film1 = document.querySelector('.film1');
var film2 = document.querySelector('.film2');
var all = document.querySelector('.all');


dsj.addEventListener("click", function () {
    film1.style.display = "none";
    film2.style.display = "flex";
    dsj.style.color = "white";
    all.style.color = "";
});
all.addEventListener("click", function () {
    film2.style.display = "none";
    film1.style.display = "flex";
    all.style.color = "white";
    dsj.style.color = "";
});
//视频切换



window.addEventListener("scroll", function () {
    var shortcut = document.querySelector('.shortcut');
    var black = document.querySelector('.black');
    var nav = document.querySelector('.nav');
    var scrollY = window.scrollY;
    var scrollX = window.scrollX;

    if (scrollY > 395) {
        shortcut.classList.add('black');
    } else {
        shortcut.classList.remove('black');
    }
    if (scrollX > 60) {
        nav.style.display = "none";
    } else {
        nav.style.display = "block";
    }
});
//横向滚动条滚动的时候



var image = ['pics/轮播1.jpg',
    'pics/轮播2.jpg',
    'pics/轮播3.jpg',
    'pics/轮播4.jpg',
    'pics/轮播5.jpg'];
var right = document.querySelector('.right');
var sy1 = document.querySelector('.sy1');
var ul = document.querySelector('ul');
var liList = ul.querySelectorAll('li');
var num = 0;
var timer;
sy1.style.backgroundRepeat = 'no-repeat';
sy1.style.backgroundSize = 'cover';

function changeImage() {
    sy1.style.backgroundImage = 'url(' + image[num] + ')';
    num++;
    if (num >= image.length) {
        num = 0;
    }
}

timer = setInterval(changeImage, 1500);

for (var i = 0; i < liList.length; i++) {
    liList[i].setAttribute('index', i);
    liList[i].addEventListener('mouseover', function () {
        clearInterval(timer);
        var index = parseInt(this.getAttribute('index'));
        num = index;
        sy1.style.backgroundImage = 'url(' + image[index] + ')';
    });
    liList[i].addEventListener('mouseout', function () {
        timer = setInterval(changeImage, 1500);
    });
}
//网页轮播图
